import java.awt.Graphics;

public class MovePossibilities {
	
	public static int move = 1;
	
	public static boolean isWiningFiveOrMore(int x, int y){
		int temp = 1;
		int toMove = Board.goban[x][y];
		int inRow = 1;
		
		//lastMove -> left && lastMove -> right
		try{
		while(Board.goban[x - temp][y] == toMove){temp++; inRow++;}
		}catch(Exception e){}
		temp = 1;
		try{
		while(Board.goban[x + temp][y] == toMove){temp++; inRow++;}
		}catch(Exception e){}
		if(inRow >= 5){
			return true;
		}
		temp = 1;
		inRow = 1;
		//lastMove -> left-top && lastMove -> right-bottom
		try{
		while(Board.goban[x - temp][y - temp] == toMove){temp++; inRow++;}
		}catch(Exception e){}
		temp = 1;
		try{
		while(Board.goban[x + temp][y + temp] == toMove){temp++; inRow++;}
		}catch(Exception e){}
		if(inRow >= 5){
			return true;
		}
		temp = 1;
		inRow = 1;
		//lastMove -> top && lastMove -> bottom
		try{
		while(Board.goban[x][y - temp] == toMove){temp++; inRow++;}
		}catch(Exception e){}
		temp = 1;
		try{
		while(Board.goban[x][y + temp] == toMove){temp++; inRow++;}
		}catch(Exception e){}
		if(inRow >= 5){
			return true;
		}
		temp = 1;
		inRow = 1;
		//lastMove -> right-top && lastMove -> left-bottom
		try{
		while(Board.goban[x + temp][y - temp] == toMove){temp++; inRow++;}
		}catch(Exception e){}
		temp = 1;
		try{
		while(Board.goban[x - temp][y + temp] == toMove){temp++; inRow++;}
		}catch(Exception e){}
		if(inRow >= 5){
			return true;
		}
		return false;
	}
	
	public static boolean isCorrect(int x, int y){
		try{
			if(Board.goban[x][y] == 0)
				return true;			
		}catch(Exception e){return false;}		
		return false;
	}
	
	public static int isOnMove(){
		return move % 2 + 1;
	}

}
